package com.example.android;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class SetActivity extends Activity {

    EditText txtEmail;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_set);
        txtEmail = (EditText)findViewById(R.id.set_email);
        
        Button btnSave = (Button)findViewById(R.id.set_btnSave);
        btnSave.setOnClickListener(new View.OnClickListener() {
            
            @Override
            public void onClick(View v) {
                String username = txtEmail.getText().toString();
                
                Bundle bundle = new Bundle();
                bundle.putString("returnStatus", "OK");
                bundle.putString("username", username);
                Intent mIntent = new Intent();
                mIntent.putExtras(bundle);
                setResult(RESULT_OK, mIntent);                
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_set, menu);
        return true;
    }

}
